package com.elong.qadev.service.impl;

import java.io.Serializable;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.elong.qadev.dao.UserDaoI;
import com.elong.qadev.entity.User;
import com.elong.qadev.service.UserServiceI;

/**
 * 
* @ClassName: UserServiceImpl
* @Description: TODO(用户操作服务相关)
* @author kangchen
* @date 2015年10月5日
*
 */
@Service("userService")
public class UserServiceImpl implements UserServiceI {
	Logger logger = Logger.getLogger(UserServiceImpl.class);
	/**
	 * 注入userDao
	 */
	@Autowired
	private UserDaoI userDao;

	@Override
	public void test() {
		logger.info("Hello,world--Hello,world!");
	}

	@Override
	public Serializable save(User user) {
		logger.info("运行UserServiceImpl");
		return userDao.save(user);
	}

	@Override
	public User getSigleUser(String mail) {
		logger.info("获取单个用户资料，错误返回null");
		if (userDao.find(mail) != null) {
			User u = userDao.find(mail);
			return u;
		}
		return null;
	}

	@Override
	public void updatePassword(User u) {
		userDao.updatePassword(u);
	}

	@Override
	public void updatePhoneNumber(User u) {
		userDao.updatePhoneNumber(u);
	}

}
